import { createApp } from "vue"
// import './style.css'
import App from "./App.vue"
import router from "./router"
import ElementUI from "element-plus"
import "element-plus/dist/index.css"
import 'animate.css';

const app = createApp(App)
app.use(router)
app.use(ElementUI)

// 白名单URL列表
const whileList = ["/"]

// 导航守卫-前置守卫：校验是否登录成功，登录成功才跳转
router.beforeEach((to, from, next) => {
	console.log(to)
	document.title = to.meta.title
	if (whileList.includes(to.path) || localStorage.getItem("token")) {
		// 如果跳转路径是白名单或者本地存储的token有值，则直接跳转
		next()
	} else {
		// 否则跳转回默认页面
		next("/")
	}
})

// 导航守卫-后置守卫
router.afterEach((to, from) => {

})

app.mount("#app")
